package main

import (
	"fmt"
)

func main() {
	channel := make(chan string)
	go sendData(channel)
	go getData(channel)
	// 主程序缺少等待， 直接退出，没有任何输出
	//time.Sleep(1*time.Second)
}

func sendData(channel1 chan string) {
	channel1 <- "a"
	channel1 <- "b"
	channel1 <- "c"
	channel1 <- "d"
	channel1 <- "e"
	channel1 <- "f"
}

func getData(ch chan string) {
	var input string
	for {
		input = <-ch
		fmt.Printf("%s", input)
	}
}
